package cn.iocoder.yudao.module.biz.dal.mysql.staffDept;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.biz.dal.dataobject.staffDept.BizStaffDeptDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.biz.controller.admin.staffDept.vo.*;

/**
 * 员工部门 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BizStaffDeptMapper extends BaseMapperX<BizStaffDeptDO> {

    default PageResult<BizStaffDeptDO> selectPage(BizStaffDeptPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BizStaffDeptDO>()
                .likeIfPresent(BizStaffDeptDO::getStaffDeptName, reqVO.getStaffDeptName())
                .betweenIfPresent(BizStaffDeptDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .eqIfPresent(BizStaffDeptDO::getDeptId, reqVO.getDeptId())
                .orderByDesc(BizStaffDeptDO::getId));
    }

    default List<BizStaffDeptDO> selectList(BizStaffDeptExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BizStaffDeptDO>()
                .likeIfPresent(BizStaffDeptDO::getStaffDeptName, reqVO.getStaffDeptName())
                .betweenIfPresent(BizStaffDeptDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .eqIfPresent(BizStaffDeptDO::getDeptId, reqVO.getDeptId())
                .orderByDesc(BizStaffDeptDO::getId));
    }

}
